#pragma once

#if defined(ARDUINO) && ARDUINO >= 100
  #include "Arduino.h"
#else
  #include "WProgram.h"
#endif


/// --- DEBUG ---

// #define DEBUG

#ifdef DEBUG

#define DEBUG_INIT() Serial.begin(9600)
#define DEBUG(a) Serial.print(a)
#define DEBUGLN1(a) Serial.println(a)
#define DEBUGLN() Serial.println()

#define INIT_MIDI()

#else // !DEBUG

#define DEBUG_INIT()
#define DEBUG(a) 
#define DEBUGLN1(a) 
#define DEBUGLN()

#define INIT_MIDI() Midi.begin()

#endif // DEBUG

/// Adressen auf dem I2C/TWI Bus

/// Basiswert für die I2C Adressen
// address of PCF8574 IC on TWI bus 0x40
// address of PCB8574AP 0x70!!!
#define START 0x70

#define IO_ADDR0 (0x70 >> 1) // Chip1
#define IO_ADDR1 (0x72 >> 1) // Chip2
#define IO_ADDR2 (0x7F >> 1) // LED Snail-Shell

#define INTERRUP_NR 1 // PIN 3
#define INTERRUP_NR_TYPE CHANGE 

#define STATE_PROGRAMMING_MODE 1
#define STATE_MUSIC_MODE 2

/* --- Blue Switch --- */

#define PIN_BLUE_SWITCH_LEFT_FACE 11
#define PIN_BLUE_SWITCH_RIGHT_NOTE 10

#define BLUE_SWITH_SPOT 3
#define BLUE_SWITCH_NOTE 1
#define BLUE_SWITCH_FACE 2

/*--- LED Control --- */

extern byte LedArray[5]; 

///
/// Chip an dem die LEDs für das Snailgehäuse angeschlossen sind.
///
#define IO_ADDR_LED_SNAIL_SHELL IO_ADDR2

///
/// Belegung der Leitungen für die LEDs
///
#define LED_VIOLETT 0
#define LED_YELLOW 1
#define LED_BLUE 2
#define LED_ORANGE 3
#define LED_RED 4


namespace globals {
  extern volatile unsigned long CurrentLoopTimeInMs;  
  extern volatile byte CurrentState;
  extern volatile short TransposeOffset;  
}


